package com.duomai.myapplication.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.duomai.myapplication.R;
import com.duomai.myapplication.adapter.EventsAdapter;
import com.duomai.myapplication.adapter.NoticeAdapter;
import com.example.admin.SQLite.BaoMing;
import com.example.admin.SQLite.Complaint;
import com.example.admin.SQLite.SqLiteOpenHelper;
import com.example.admin.SQLite.dao.BaoMingDao;
import com.example.admin.base.BaseActivity;

import java.util.ArrayList;

//活动
public class EventsActivity extends BaseActivity {
    EventsAdapter mAdapter;
     BaoMingDao baoMingDao;
    RecyclerView recyclerView;


    @Override
    public void setContentView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_events);
        recyclerView = findViewById(R.id.recyclerView);
        mAdapter = new EventsAdapter();
        recyclerView.setAdapter(mAdapter);
        baoMingDao = new BaoMingDao(this);
        getdata();
        mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                startActivity(new Intent(EventsActivity.this, EventsDetailActivity.class)
                        .putExtra("bean", mAdapter.getItem(position)));
            }
        });

    }

    @Override
    public void setInitView() {

    }

    private void getdata() {
        ArrayList<BaoMing> list = baoMingDao.FindWhereData();
        mAdapter.setNewData(list);
    }
}